package ycl.important.common.base.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import ycl.important.common.base.entity.BaseRegionEntity;

import java.util.List;

/**
 * 地区实体数据库基类
 *
 * @author: YCL
 * @date: 2021-10-06 21:22:40
 */
@Repository
@Mapper
public interface BaseRegionMapper<T extends BaseRegionEntity>
		extends BaseDao<T> {

	@Select("select * from ${name} where code = #{code} limit 1")
	T getByCode(@Param("name") String tableName, @Param("code") String code);

	@Select("select * from ${name} where parent_code = #{code}")
	List<T> getByParentCode(@Param("name") String tableName, @Param("code") String code);
}
